package Test;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import Systeem.*;
public class TestReservering  extends junit.framework.TestCase{
	private Reservering reservering;
	private AbstractKamer kamer;
	private Gast gast;
	private SimpleDateFormat sdf;
	
	public void setUp() {
		gast = new Gast("TestGast");
		kamer = new Kamer(1,2,3,4);
		sdf = new SimpleDateFormat("dd-MM-yyyy");
		try {
			reservering = new Reservering(gast, kamer,sdf.parse("05-01-2010"), sdf.parse("10-01-2010"));
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	public void testGetVerblijfPeriode() {
		assertEquals("Test verblijf periode", reservering.getVerblijfPeriode(), 4);
		
		
		
	}
	public void testInConflictMet() {
		try {
			// data voor de reservering
			assertEquals("Test in conflict met #1", reservering.inConflictMet(sdf.parse("01-01-2010"), sdf.parse("05-01-2010")), false);
			//data na de reservering
			assertEquals("Test in conflict met #2", reservering.inConflictMet(sdf.parse("10-01-2010"), sdf.parse("18-01-2010")), false);
			//begin datum voor, eind datum na de reservering
			assertEquals("Test in conflict met #3", reservering.inConflictMet(sdf.parse("03-01-2010"), sdf.parse("11-01-2010")), true);
			// begin datum in, eind datum na de reservering
			assertEquals("Test in conflict met #4", reservering.inConflictMet(sdf.parse("09-01-2010"), sdf.parse("13-01-2010")), true);
			// begin datum voor de reservering, eind datum in de reservering
			assertEquals("Test in conflict met #5", reservering.inConflictMet(sdf.parse("01-01-2010"), sdf.parse("06-01-2010")), true);
			//Begin en eind data in de reservering
			assertEquals("Test in conflict met #6", reservering.inConflictMet(sdf.parse("06-01-2010"), sdf.parse("09-01-2010")), true);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}


}
